<?php

namespace app\store\model;

use think\Model;

class User extends Model
{
    protected $schema = [
        'id' => 'int',
        'store_id' => 'int',
        'user_id' => 'int',
        'user_grade_id' => 'int',
        'parent_id' => 'int',
        'parent_path' => 'string',
        'invite_code' => 'string',
        'birthday' => 'string',
        'nickname' => 'string',
        'avatar' => 'string',
        'gender' => 'boolean',
        'integral' => 'int',
        'balance' => 'float',
        'gold' => 'int',
    ];

    protected $readonly = [
        'user_id','balance','integral','gold'
    ];

    public function setPasswordAttr($value)
    {
        return password_hash($value,PASSWORD_DEFAULT);
    }
}